﻿using Ninject;
using Realm.Admin.DAL.DependencyModules;
using Realm.DAL.Common;
using Realm.DAL.DependencyModules;
using Realm.Live.DAL.DependencyModules;

namespace Realm.Web
{
    public static class RepositoryFactory
    {
        public static IKernel Kernel { get; set; }

        public static T CreateInstance<T>() where T : IRealmContext
        {
            if (Kernel == null)
                Kernel = new StandardKernel(
                    new RealmDbContextModule(),
                    new RealmAdminDbContextModule(),
                    new RealmLiveDbContextModule());
            return Kernel.Get<T>();
        }
    }
}